package com.latefly.skewwork.ui.page.practice

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Layout

//自定义的列布局
@Composable
fun MyOwnColum(
    modifier: Modifier.Companion =Modifier,
    content:@Composable () -> Unit
) {
    Layout(
        modifier = modifier,
        content=content
    ){measurables,constraints->
        val placeables=measurables.map { measurable ->
            measurable.measure(constraints)
        }
        var yPosition=0
        layout(constraints.maxWidth,constraints.maxHeight){
            placeables.forEach { placeable ->
                placeable.placeRelative(x=0,y=yPosition)
                yPosition+=placeable.height
            }
        }
    }
}


